import React from "react";
import commonTypes from "../utils/commonTypes";

// 根据数据渲染出的一组表单组件
export default function withDataList(Comp) {
    return class DataListWrapper extends React.Component {

        
        static defaultProps = {
            options: [],
        }

        static propTypes = {
            options: commonTypes.options,
        }

        render() {
            return (
                <>
                    {
                        this.props.options.map(
                            (item, index) => <Comp key={index} optionItem={item} {...this.props} />
                        )
                    }
                </>
            )
        }

    }
}